package _2响应头;

import java.io.IOException;
import java.io.PrintWriter;

import javax.jws.WebService;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sun.net.httpserver.HttpServer;

@WebServlet("/loginchk")
public class LoginCheckServlet  extends HttpServlet
{


	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException 
	{

		String username = req.getParameter("username");
		String password = req.getParameter("password");
		System.out.println(username+","+password);
		
		PrintWriter pw = resp.getWriter();
		

		if(username.equals("admin")&&password.equals("123456"))
		{
           resp.sendRedirect("http://localhost:8011/05-Response/loginOK.html");
			
		}
		else
		{
			resp.sendRedirect("http://localhost:8011/05-Response/loginFail.html");
		}
		
		
	}
}

